# $Id: PKGBUILD 77845 2012-10-15 09:20:51Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=dokuwiki
pkgver=20121013
_pkgver=2012-10-13
pkgrel=1
pkgdesc="DokuWiki engine"
arch=('any')
url="http://www.splitbrain.org/projects/dokuwiki"
license=('GPL')
depends=('php')
backup=('etc/webapps/dokuwiki/.htaccess')
install=dokuwiki.install
options=('!strip')
source=(http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-${_pkgver}.tgz)
md5sums=('a910ebb2fcca13c0337ed672304c4ad4')

package() {
  cd $srcdir
  install -dm0755 $pkgdir/usr/share/webapps/
  install -dm0755 $pkgdir/var/lib/
  install -dm0755 $pkgdir/etc/webapps/
  cp -a $pkgname-${_pkgver} $pkgdir/usr/share/webapps/dokuwiki

  mv $pkgdir/usr/share/webapps/dokuwiki/data $pkgdir/var/lib/dokuwiki
  ln -s /var/lib/dokuwiki $pkgdir/usr/share/webapps/dokuwiki/data
  touch $pkgdir/var/lib/dokuwiki/changes.log
  chmod 0644 $pkgdir/var/lib/dokuwiki/changes.log
  find $pkgdir/var/lib/dokuwiki -type f -exec chmod g=rw {} \; && find -type d -exec chmod g=rwx {} \;

  mv $pkgdir/usr/share/webapps/dokuwiki/conf $pkgdir/etc/webapps/dokuwiki
  ln -s /etc/webapps/dokuwiki $pkgdir/usr/share/webapps/dokuwiki/conf
  chmod g=rwx $pkgdir/etc/webapps/dokuwiki

  cp $pkgdir/usr/share/webapps/dokuwiki/.htaccess.dist $pkgdir/etc/webapps/dokuwiki/.htaccess
  ln -s /etc/webapps/dokuwiki/.htaccess $pkgdir/usr/share/webapps/dokuwiki/.htaccess
}
